package org.example.model;

import lombok.Data;
import org.example.utils.DateUtils;

import java.util.Date;

@Data
public class BlogInfo {
    private Integer id;
    private String title;
    private String content;
    private Integer userId;
    private boolean loginUser;
    private Integer deleteFlag;
    private Date createTime;
    private Date updateTime;

    // 按格式返回创建时间
    public String getCreateTime() {
        if (createTime == null) {
            return DateUtils.dateFormat(new Date(System.currentTimeMillis()));
        }
        return DateUtils.dateFormat(createTime);
    }
}

